<div id="reviewmodal" class="modalst reveal-modal small" data-reveal data-options="closeOnBackgroundClick:false">
	<div class="row">
	  <div class="small-11 large-12 columns small-centered" style="padding:0;">
	    <div class="alert-panel" data-alert>
	      <div class="alert-panel-title">
	     <label><strong style="color:white !important;">Review</strong></label>
	        <a class="alert-panel close">&times;</a>
	      </div>
	      <div class="alert-panel-message">
	      <label style="margin-bottom:1rem;"><strong>Your Review</strong></label>
	        <textarea id="txtYourReview" style="border:solid 1px gray !important;">The company is good. They offer high salary to deserving employees!</textarea>
	      </div>
	      <div class="alert-panel-message" style="margin-top:-2rem;">
	      <label><strong>Rate them now</strong></label>
	      <div  id= "reviewRating"  data-average="10.34" data-id="1" style="margin:0;margin-top:.5rem;margin-bottom:.5rem;"></div>
	      <small>Note: You are only allowed to rate once in every 3 days to avoid spamming.</small>
	      </div>
	      <div class="alert-panel-action">
	        <a class="tiny button radius secondary">Cancel</a>
	        <a class="tiny button radius success btnSaveReview">Save</a>
	      </div>
	    </div>
	  </div>
	</div>      
</div>

<div id="PostJob" class="modalst reveal-modal small" data-reveal data-options="closeOnBackgroundClick:false">
	<div class="row">
	  <div class="small-11 large-12 columns small-centered" style="padding:0;">
	    <div class="alert-panel" data-alert>
	      <div class="alert-panel-title">

	     <label><strong style="color:white;">Post Job</strong></label>
	      </div>
	      <div class="alert-panel-message">
                <div class="row collapse">
                    <div class="small-3 large-2 columns">
                      <span class="prefix" style="border:none;color:gray;">Title</span>
                    </div>
                    <div class="small-9 large-10 columns">
                      <input type="text" style="border:none;">
                    </div>
                </div>
                <div class="row collapse">
                    <div class="small-3 large-2 columns">
                      <span class="prefix" style="border:none;color:gray;">Link</span>
                    </div>
                    <div class="small-9 large-10 columns">
                      <input type="text" style="border:none;">
                    </div>
                </div>           
	      <label style="color:#009EA1"><strong>Job Description</strong></label>
	        <textarea placeholder="Write the Job Description here"></textarea>
	        <div class="row" style="padding:0;">
	            <div class="medium-12 column">
	                <label style="color:#009EA1"><strong>Field and Skills required</strong></label>
                	<select style="border:none;">
                		<option>Bachelor of Science in Information Technology</option>
                	</select>
                </div>
                <div class="medium-12 column">
	                <div class="row collapse">
	                    <div class="small-3 large-2 columns">
	                      <span class="prefix" style="border:none;color:gray;">Skills</span>
	                    </div>
	                    <div class="small-9 large-10 columns">
	                      <input type="text" style="border:none;">
	                    </div>
	                </div>
                </div>         	
	        </div>
	      </div>
	      <div class="alert-panel-action">
	        <a class="tiny button radius secondary">Cancel</a>
	        <a class="tiny button radius success">Post</a>
	      </div>
	    </div>
	  </div>
	</div>      
</div>

<div id="suggestedits" class="modalst reveal-modal medium" data-reveal data-options="closeOnBackgroundClick:false">
<fieldset id="frmSuggestEdit" style="border:none;">

<div class="row">
	<div class="medium-12 column" style="padding:0;">
	    <div class="alert-panel" data-alert>
	    	<div class="alert-panel-title">
	     		<label><strong style="color:white;">Edit Page</strong></label>
	      	</div>

	      	<div class="alert-panel-message">
				<div class="suggest row">

			  	<div class="medium-12 column" style="padding:0;">
			  		<div style="height:95%;">
						<div class="medium-5 column">
							<input type="hidden" name="company_id" value="<?=$company_id?>" />
							<div class="suggest-card medium-12 column">
								<div class="medium-12 column" style="padding:0;">
									<input name="name" type="text" placeholder="Enter suggested name">
								</div>
							</div>
							<div class="suggest-card medium-12 column">
								<div class="medium-12 column" style="padding:0;">
									<input id="address" name="location" type="text" placeholder="Enter suggested address" onclick="initialize(), cleartext();">
									<div>
										<div class="large-4 columns" style="opacity: 0;">
											<input name="latlng" id="latlng" type="" onfocus="codeLatLng();" onchange="codeLatLng();" size=60 readonly>
										</div>
										<div class="large-4 columns" style="opacity: 0;">
											<input name="city" id="city" type="" size=60 readonly>
										</div>
										<div class="large-4 columns" style="opacity: 0;">
											<input id="string" type="" size=60 readonly>
										</div>	
									</div>
								</div>
							</div>
							<div class="medium-12 column" style="padding:0;">
								<textarea name="about" placeholder="About" style="height:5rem;"></textarea>
							</div>
							<div class="suggest-card medium-12 column">
								<div class="medium-12 column" style="padding:0;">
									<input name="contact_no" type="text" placeholder="Contact No">
								</div>
							</div>
							<div class="suggest-card medium-12 column">
								<div class="medium-12 column" style="padding:0;">
									<input name="email" type="text" placeholder="Email">
								</div>
							</div>
							<div class="suggest-card medium-12 column">
								<div class="medium-12 column" style="padding:0;">
									<input name="noofworkers" type="text" placeholder="No of Workers">
								</div>
							</div>
						</div>

						<div class="map medium-7 column">
					
						<!--Google Map-->
							<div id="modal-canvas" class="map-canvas large-12 column"></div>
					    </div>
					</div>
			  	</div>
			</div>
	      </div>
	      <div class="alert-panel-action">
	        <a class="tiny button radius secondary">Cancel</a>
	        <a class="tiny button radius success btnSubmitEdits">Submit</a>
	      </div>
	    </div>
	</div>
<!--Results output-->

</fieldset>	
</div>      
</div>



<script type="text/javascript">
function saveEdits(data)
{	
	var params = {};
	params.data = data;
	return $.ajax({
		url: URL + 'suggestedit/save',
		data: params,
		dataType: 'json',
		type: 'post'
	});
}
	$(document).ready(function(){
		$(document).on('click','.btnSubmitEdits',function(){
			var data = $('#frmSuggestEdit').serialize();
			var curr = $(this);
			var for_confirmation = "Are you sure you want to submit this changes? \n";
			var is_empty = true;

			$.each(data.split('&'),function(index,elem){
				var vals = elem.split('=');
				if(vals[1] != "" && vals[0] != "latlng" && vals[0] != "company_id"){
					is_empty = false;
					for_confirmation += vals[0].capitalize() + ': ' + decodeURIComponent(vals[1]) + '\n'; 
				}
			});

			if(is_empty)
			{
				return false;
			}
			var r = confirm(for_confirmation);
			if(r == true){
				curr.html('Proccessing <img src="<?=BASE_URI?>img/loading2.gif" />');	
				saveEdits(data).done(function(result){
					if(result.status){
						alert("Your edits has been saved please wait for admin confirmation");
						curr.html("Save");
						setTimeout(function(){$('#suggestedits').foundation('reveal','close');},1500);
					}else{
						alert(result.messages);
						curr.html("Save");
					}
				});
			}
			
			

		});
	});	

	String.prototype.capitalize = function() {
    	return this.charAt(0).toUpperCase() + this.slice(1);
	}
</script>



